package com.exercises;

class Exercise1310 {
    public static void main(String[] args) {

    }

    public static int[] xorQueries(int[] arr, int[][] queries) {
        int length = arr.length;
        int[] prefixXOR = new int[length + 1];
        for (int i = 0; i < length; i++) {
            prefixXOR[i + 1] = prefixXOR[i] ^ arr[i];
        }

        length = queries.length;
        int[] result = new int[length];
        for (int i = 0; i < length; i++) {
            result[i] = prefixXOR[queries[i][0]] ^ prefixXOR[queries[i][1] + 1];
        }
        return result;
    }
}

